package link.anyauto.study.dagger.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.lang.reflect.Type;

/**
 * Created by LYQ on 2016/5/20.
 */
public class GsonUtil {
    public static final Gson gson = new GsonBuilder().create();

    public static Gson getGson() {
        return gson;
    }

    public static String toJson(Object obj) {
        return gson.toJson(obj);
    }

    public static <T> T fromJson(String src, Class<T> clz) {
        return gson.fromJson(src, clz);
    }

    public static <T> T fromJson(String src, Type type) {
        return gson.fromJson(src, type);
    }
}
